home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 050 / madtrb2.arc / S_INPUT2.INC < prev    next >
Encoding:
Text File  |  1986-02-27  |  56.7 KB  |  1,274 lines

  1. { S_INPUT2.INC }
  2.  
  3. { *************************************************************************** }
  4. { *                                                                         * }
  5. { *                TURBO SCREEN INPUT PRE-PROCESSOR TOOLKIT                 * }
  6. { *                                                                         * }
  7. { *               SCROLLING INPUT SUBPROGRAM INCLUDE FILE  #2               * }
  8. { *                                                                         * }
  9. { *                             Version  1.07                               * }
  10. { *                                                                         * }
  11. { *                                                                         * }
  12. { *    This is the second include file for the scrolling window page        * }
  13. { *    module.  This file wust be used in conjunction with the include      * }
  14. { *    file 'S_Input1.Inc' .                                                * }
  15. { *                                                                         * }
  16. { *    Note that further documentation on scrolling input page support can  * }
  17. { *    be found in the documentation file 'Tsipp.Doc'.                      * }
  18. { *                                                                         * }
  19. { *************************************************************************** }
  20.  
  21.  
  22.  
  23. Procedure ShowRowOfInputData(    Row,
  24.                                  CurrentTopMostDataRow,
  25.                                  CurrentLeftMostDataCol,
  26.                                  CurrentRightMostDataCol:Integer);
  27.  
  28. { This procedure shows input data for the passed data row number, at a computed
  29.   location within the scrolling window. }
  30.  
  31. Var
  32.   Col:Integer;                         { column index for printing out input data }
  33.   ScreenCol:Integer;                   { column index for claering out ould entry }
  34.  
  35. Begin   { ShowRowOfInputData }
  36.   { define a portion of the screen that the data is scrolled in as the active window }
  37.   Window(LEFT_EDGE_OF_INNER_SCROLL_WINDOW,
  38.          TOP_EDGE_OF_INNER_SCROLL_WINDOW,
  39.          RightEdgeOfInnerScrollWindow,
  40.          BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW);
  41.   TextColor(ForegroundColor);
  42.   TextBackground(InputWindowColor);
  43.   GotoXY(2,Row-CurrentTopMostDataRow+1);
  44.     Write(Row,'    ');                 { Write row number onto window }
  45.   For Col:=1 To (CurrentRightMostDataCol-CurrentLeftMostDataCol+1) Do
  46.     Begin                              { fill scrolling window row with input data }
  47.       GotoXY((Col*COL_WIDTH)+1,Row-CurrentTopMostDataRow+1);
  48.         For ScreenCol:=1 To MAX_SIZE_OF_S_I_ENTRY Do { clear old entry }
  49.           Write(' ');
  50.       GotoXY((Col*COL_WIDTH)+1,Row-CurrentTopMostDataRow+1);
  51.         Write(S_I_Data[(CurrentLeftMostDataCol+Col-1),Row,S_I_Page]^); { write new entry }
  52.     End; { For Col }
  53. End;    { ShowRowOfInputData }
  54.  
  55.  
  56.  
  57. Procedure Show_S_I_EmptyEntry(    NewCol,
  58.                                   NewRow,
  59.                                   CurrentTopMostDataRow,
  60.                                   CurrentLeftMostDataCol,
  61.                                   CurrentRightMostDataCol:Integer);
  62.  
  63. { This procedure prints out the proper sized reversed video input block
  64.   to show an empty entry at the passed position in the current scrolling
  65.   window. }
  66.  
  67. Var
  68.   Col:Integer;                         { column index counter used in writing out the input block }
  69.  
  70. Begin   { Show_S_I_EmptyEntry }
  71.   Window(LEFT_EDGE_OF_INNER_SCROLL_WINDOW,
  72.          TOP_EDGE_OF_INNER_SCROLL_WINDOW,
  73.          RightEdgeOfInnerScrollWindow,
  74.          BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW);
  75.   TextColor(BlockForegroundColor);
  76.   TextBackground(BlockBackgroundColor);
  77.   GotoXY(((NewCol-CurrentLeftMostDataCol+1)*COL_WIDTH)+1,NewRow-CurrentTopMostDataRow+1);
  78.   For Col:=1 To MAX_SIZE_OF_S_I_ENTRY Do { write out reversed video input block }
  79.     Write(' ');
  80.   GotoXY(((NewCol-CurrentLeftMostDataCol+1)*COL_WIDTH)+1,NewRow-CurrentTopMostDataRow+1); { goto front of input block }
  81. End;    { Show_S_I_EmptyEntry }
  82.  
  83.  
  84.  
  85. Procedure Show_S_I_CharEntry(    LegalChar:Char);
  86.  
  87. { This procedure prints the passed legal character entry in the current
  88.   reversed video data input block. }
  89.  
  90. Begin   { Show_S_I_CharEntry }
  91.   TextColor(CharacterInputColor);
  92.   TextBackground(InputWindowColor);
  93.   Write(LegalChar);
  94. End;    { Show_S_I_CharEntry }
  95.  
  96.  
  97.  
  98. Procedure MoveScrollWindowInputBlockModule(    OldCol,
  99.                                                OldRow,
  100.                                                NewCol,
  101.                                                NewRow,
  102.                                                CurrentTopMostDataRow,
  103.                                                CurrentLeftMostDataCol,
  104.                                                CurrentRightMostDataCol:Integer);
  105.  
  106. { *************************************************************************** }
  107. { *                                                                         * }
  108. { *                MOVE SCROLLING WINDOW INPUT BLOCK MODULE                 * }
  109. { *                                                                         * }
  110. { *     This module controls the movement of the highlighted prompt and     * }
  111. { *     input block using the passed OldCol, Oldrow position and passed     * }
  112. { *     NewCol, NewRow position for the current scrolling input page.       * }
  113. { *                                                                         * }
  114. { *************************************************************************** }
  115.  
  116.  
  117.  
  118.   Procedure ShowInputPrompt(    InputCol,
  119.                                 InputRow,
  120.                                 PromptColor,
  121.                                 PromptBackground,
  122.                                 BlockColor,
  123.                                 BlockBackground:Integer);
  124.  
  125.   { This procedure is used exclusively to highlight the current column and row
  126.     prompts and input block and also to de-highlight the previous column and
  127.     row prompts and input block in the scrolling window. }
  128.  
  129.   Var
  130.     Col:Integer;                       { column index counter used in erasing old input data entries }
  131.  
  132.   Begin   { ShowInputPrompt }
  133.  
  134.     { define a portion of the screen that the data is scrolled in as the active window }
  135.     Window(LEFT_EDGE_OF_INNER_SCROLL_WINDOW,
  136.            TOP_EDGE_OF_INNER_SCROLL_WINDOW,
  137.            RightEdgeOfInnerScrollWindow,
  138.            BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW);
  139.     TextColor(ForegroundColor);
  140.     TextBackground(InputWindowColor);
  141.  
  142.     { remove old data entry }
  143.     GotoXY(((InputCol-CurrentLeftMostDataCol+1)*COL_WIDTH)+1,InputRow-CurrentTopMostDataRow+1);
  144.       For Col:=1 To MAX_SIZE_OF_S_I_ENTRY Do
  145.         Write(' ');
  146.  
  147.     { rewrite row prompt }
  148.     TextColor(PromptColor);
  149.     TextBackground(PromptBackground);
  150.     GotoXY(2,InputRow-CurrentTopMostDataRow+1);
  151.       Write(InputRow,'    ');
  152.  
  153.     { define a portion of the screen that the data is scrolled in as the active window }
  154.     Window(LEFT_EDGE_OF_INNER_SCROLL_WINDOW,
  155.            TOP_EDGE_OF_OUTER_SCROLL_WINDOW,
  156.            RightEdgeOfOuterScrollWindow,
  157.            BOTTOM_EDGE_OF_OUTER_SCROLL_WINDOW);
  158.  
  159.   { rewrite column prompt, this routine assumes that there are only 3 lines to each column heading }
  160.     GotoXY(((InputCol-CurrentLeftMostDataCol+1)*COL_WIDTH)+1,2);  { Input entry heading }
  161.       Write(S_I_Pages[S_I_Page].Prompts[InputCol+1].Prompt1);
  162.     GotoXY(((InputCol-CurrentLeftMostDataCol+1)*COL_WIDTH)+1,3);  { Input entry heading }
  163.       Write(S_I_Pages[S_I_Page].Prompts[InputCol+1].Prompt2);
  164.     GotoXY(((InputCol-CurrentLeftMostDataCol+1)*COL_WIDTH)+1,4);  { Input entry heading }
  165.       Write(S_I_Pages[S_I_Page].Prompts[InputCol+1].Prompt3);
  166.  
  167.     { define a portion of the screen that the data is scrolled in as the active window }
  168.     Window(LEFT_EDGE_OF_INNER_SCROLL_WINDOW,
  169.            TOP_EDGE_OF_INNER_SCROLL_WINDOW,
  170.            RightEdgeOfInnerScrollWindow,
  171.            BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW);
  172.     TextColor(BlockColor);
  173.     TextBackground(BlockBackground);
  174.  
  175.     { show new data entry }
  176.     GotoXY(((InputCol-CurrentLeftMostDataCol+1)*COL_WIDTH)+1,InputRow-CurrentTopMostDataRow+1); { goto front of data entry }
  177.       If S_I_Data[InputCol,InputRow,S_I_Page]^='' Then
  178.         For Col:=1 To MAX_SIZE_OF_S_I_ENTRY Do
  179.           Write(' ')                   { write reversed video input block }
  180.       Else
  181.         Write(S_I_Data[InputCol,InputRow,S_I_Page]^); { write data entry }
  182.  
  183.   End;    { ShowInputPrompt }
  184.  
  185.  
  186.  
  187. Begin   { MoveScrollWindowInputBlockModule }
  188.   ShowInputPrompt(OldCol,              { de-highlight old input prompt and corresponding input entry }
  189.                   OldRow,
  190.                   ForegroundColor,
  191.                   InputWindowColor,
  192.                   ForegroundColor,
  193.                   InputWindowColor);
  194.   ShowInputPrompt(NewCol,              { highlight new input prompt and corresponding input entry }
  195.                   NewRow,
  196.                   HighlightColor,
  197.                   InputWindowColor,
  198.                   InputWindowColor,
  199.                   ForegroundColor);
  200.   HighlightSpecial_S_I_Prompts(CurrentLeftMostDataCol,
  201.                                CurrentRightMostDataCol);
  202. End;    { MoveScrollWindowInputBlockModule }
  203.  
  204.  
  205.  
  206. Procedure  Draw_S_I_PagesModule(    CurrentTopMostDataRow,
  207.                                     CurrentLeftMostDataCol,
  208.                                     CurrentRightMostDataCol:Integer);
  209.  
  210. { *************************************************************************** }
  211. { *                                                                         * }
  212. { *                    DRAW SCROLLING INPUT PAGES MODULE                    * }
  213. { *                                                                         * }
  214. { *    This module controls the drawing of the scrolling input pages.       * }
  215. { *    Note that the case statement below only supports 4 general input     * }
  216. { *    pages, but this can easily be added to inorder for this module to    * }
  217. { *    support additional scrolling input pages.                            * }
  218. { *                                                                         * }
  219. { *    Note that within this module there is an example procedure that      * }
  220. { *    was used during program development to construct a screen page.      * }
  221. { *    Later, the screen pages are read from screen files and stored in the * }
  222. { *    heap for more rapid display.                                         * }
  223. { *                                                                         * }
  224. { *************************************************************************** }
  225.  
  226.  
  227.  
  228.   Procedure DrawScrollingInputWindow;
  229.  
  230.   { This procedure draws the scrolling input window onto the scrolling input
  231.     pages.  Note that the case statement below only supports 4 scrolling input
  232.     pages, but can easily be added to inorder to support additional scrolling
  233.     input pages. }
  234.  
  235.   Var
  236.     Col:Integer;                       { a column index counter used in displaying column prompts }
  237.  
  238.   Begin   { DrawScrollingInputWindow }
  239.     TextColor(InputWindowBorderColor);
  240.     TextBackground(InputWindowColor);
  241.     Case S_I_Page Of
  242.       1 : Begin
  243.             DrawWindow2(LEFT_EDGE_OF_OUTER_SCROLL_WINDOW,
  244.                         TOP_EDGE_OF_OUTER_SCROLL_WINDOW,
  245.                         RightEdgeOfOuterScrollWindow,
  246.                         BOTTOM_EDGE_OF_OUTER_SCROLL_WINDOW);
  247.             DrawHorizWindowLine2(LEFT_EDGE_OF_OUTER_SCROLL_WINDOW,
  248.                         TOP_EDGE_OF_INNER_SCROLL_WINDOW-1,
  249.                         RightEdgeOfOuterScrollWindow);
  250.           End; { page 1 }
  251.       2 : Begin
  252.             DrawWindow2(LEFT_EDGE_OF_OUTER_SCROLL_WINDOW,
  253.                         TOP_EDGE_OF_OUTER_SCROLL_WINDOW,
  254.                         RightEdgeOfOuterScrollWindow,
  255.                         BOTTOM_EDGE_OF_OUTER_SCROLL_WINDOW);
  256.             DrawHorizWindowLine2(LEFT_EDGE_OF_OUTER_SCROLL_WINDOW,
  257.                         TOP_EDGE_OF_INNER_SCROLL_WINDOW-1,
  258.                         RightEdgeOfOuterScrollWindow);
  259.           End; { page 2 }
  260.       3 : Begin
  261.             DrawWindow2(LEFT_EDGE_OF_OUTER_SCROLL_WINDOW,
  262.                         TOP_EDGE_OF_OUTER_SCROLL_WINDOW,
  263.                         RightEdgeOfOuterScrollWindow,
  264.                         BOTTOM_EDGE_OF_OUTER_SCROLL_WINDOW);
  265.             DrawHorizWindowLine2(LEFT_EDGE_OF_OUTER_SCROLL_WINDOW,
  266.                         TOP_EDGE_OF_INNER_SCROLL_WINDOW-1,
  267.                         RightEdgeOfOuterScrollWindow);
  268.           End; { page 3 }
  269.       4 : Begin
  270.             DrawWindow2(LEFT_EDGE_OF_OUTER_SCROLL_WINDOW,
  271.                         TOP_EDGE_OF_OUTER_SCROLL_WINDOW,
  272.                         RightEdgeOfOuterScrollWindow,
  273.                         BOTTOM_EDGE_OF_OUTER_SCROLL_WINDOW);
  274.             DrawHorizWindowLine2(LEFT_EDGE_OF_OUTER_SCROLL_WINDOW,
  275.                         TOP_EDGE_OF_INNER_SCROLL_WINDOW-1,
  276.                         RightEdgeOfOuterScrollWindow);
  277.           End; { page 4 }
  278.     End; { Case Page }
  279.     { routine to display column headings, this routine assumes that there are only 3 lines to each column heading }
  280.     TextColor(ForegroundColor);
  281.     Window(LEFT_EDGE_OF_INNER_SCROLL_WINDOW,
  282.            TOP_EDGE_OF_OUTER_SCROLL_WINDOW,
  283.            RightEdgeOfOuterScrollWindow,
  284.            BOTTOM_EDGE_OF_OUTER_SCROLL_WINDOW);
  285.     For Col:=MAX_LEFT_COL To CurrentRightMostDataCol-CurrentLeftMostDataCol+2 Do
  286.       Begin
  287.         GotoXY(((Col-1)*COL_WIDTH)+1,2);
  288.           Write(S_I_Pages[S_I_Page].Prompts[Col].Prompt1);
  289.         GotoXY(((Col-1)*COL_WIDTH)+1,3);
  290.           Write(S_I_Pages[S_I_Page].Prompts[Col].Prompt2);
  291.         GotoXY(((Col-1)*COL_WIDTH)+1,4);
  292.           Write(S_I_Pages[S_I_Page].Prompts[Col].Prompt3);
  293.       End; { For Col }
  294.   End;    { DrawScrollingInputWindow }
  295.  
  296.  
  297.  
  298.   Procedure Display_S_I_Data;
  299.  
  300.   { This procedure fills the initially empty scrolling input data window for
  301.     the current S_I_Page with input data. }
  302.  
  303.   Var
  304.     Row:Integer;                       { index to a data input row }
  305.  
  306.   Begin   { Display_S_I_Data }
  307.     For Row:=1 To BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW-TOP_EDGE_OF_INNER_SCROLL_WINDOW+1 Do
  308.       ShowRowOfInputData(Row,
  309.                          CurrentTopMostDataRow,
  310.                          CurrentLeftMostDataCol,
  311.                          CurrentRightMostDataCol);
  312.   End;    { Display_S_I_Data }
  313.  
  314.  
  315.  
  316.   Procedure Draw_S_I_Pages01to04;
  317.  
  318.   { This procedure was used during program development to construct the screen
  319.     page.  The screen page is now stored in a screen file and thus the
  320.     application program does not really need this code any longer.  The screen
  321.     page is read from a file and stored in the heap for rapid display.
  322.  
  323.     You may want to write a similar procedure during your application program
  324.     development. }
  325.  
  326.   Var
  327.     Page:String[2];                    { string variable used to store the converted page number }
  328.     TextString:WorkString;             { string variable used in passing text to another procedure }
  329.  
  330.   Begin   { Draw_S_I_Pages01to04 }
  331.     TextColor(ForegroundColor);
  332.     TextBackground(BackgroundColor);
  333.     DrawWindow2(1,1,80,25);
  334.  
  335.     { place menu on bottom portion of screen pertaining to proper page }
  336.     If S_I_Page=4 Then
  337.       Begin
  338.         TextString:='PgUp   '+Chr(27)+'   '+Chr(26)+'   '+Chr(24)+'   '+Chr(25)+'   Del   Esc';
  339.         WriteCenterText(25,TextString);
  340.       End
  341.     Else
  342.       Begin
  343.         TextString:='PgUp   PgDn   '+Chr(27)+'   '+Chr(26)+'   '+Chr(24)+'   '+Chr(25)+'   Del   Esc';
  344.         WriteCenterText(25,TextString);
  345.       End; { Else }
  346.  
  347.     { place heading at top of screen }
  348.     TextColor(HighlightColor);
  349.     Case S_I_Page Of
  350.       1 : WriteCenterText(1,'UNIFORM LOADINGS ON MEMBER');
  351.       2 : WriteCenterText(1,'POINT LOADINGS ON MEMBER');
  352.       3 : WriteCenterText(1,'PRISMATIC LOADINGS ON MEMBER');
  353.       4 : WriteCenterText(1,'APPLIED MOMENTS ON MEMBER');
  354.     End; { Case Page }
  355.  
  356.     TextColor(ForegroundColor);
  357.     DrawSimpleBeam;                    { specific to the example application of the input pre-processor }
  358.     DrawScrollingInputWindow;
  359.     HighlightSpecial_S_I_Prompts(CurrentLeftMostDataCol,
  360.                                  CurrentRightMostDataCol);
  361.     Str(S_I_Page,Page);
  362.     If S_I_Page<=9 Then
  363.       Page:='0'+Page;
  364. (*  WriteScreenPageToFile('S_I_'+Page); { write the screen page off to a screen file } *)
  365.   End;    { Draw_S_I_Pages01to04 }
  366.  
  367.  
  368. Begin   { Draw_S_I_PagesModule }
  369.   Case S_I_Page Of
  370.     1 : Begin
  371. (*        Draw_S_I_Pages01to04;        { this line was used during program development } *)
  372.           DisplayScreenPage(S_I_Pages[S_I_Page].Image); { display screen page that is stored in the heap }
  373.         End; { page 1 }
  374.     2 : Begin
  375. (*        Draw_S_I_Pages01to04;        { this line was used during program development } *)
  376.           DisplayScreenPage(S_I_Pages[S_I_Page].Image); { display screen page that is stored in the heap }
  377.         End; { page 2 }
  378.     3 : Begin
  379. (*        Draw_S_I_Pages01to04;        { this line was used during program development } *)
  380.           DisplayScreenPage(S_I_Pages[S_I_Page].Image); { display screen page that is stored in the heap }
  381.         End; { page 3 }
  382.     4 : Begin
  383. (*        Draw_S_I_Pages01to04;        { this line was used during program development } *)
  384.           DisplayScreenPage(S_I_Pages[S_I_Page].Image); { display screen page that is stored in the heap }
  385.         End; { page 4 }
  386.   End; { Case S_I_Page }
  387.  
  388.   DisplayBeamLength;                   { specific to example application of the input pre-processor }
  389.  
  390.   Display_S_I_Data;
  391.   MoveScrollWindowInputBlockModule(1,  { place input block at first entry }
  392.                                    1,
  393.                                    1,
  394.                                    1,
  395.                                    CurrentTopMostDataRow,
  396.                                    CurrentLeftMostDataCol,
  397.                                    CurrentRightMostDataCol);
  398.  
  399.   DisplayBeamLoadModule(1,1);          { specific to example application of the input pre-processor }
  400.  
  401. End;    { Draw_S_I_PageModule }
  402.  
  403.  
  404.  
  405. Procedure Check_S_I_CharEntryModule(    NewCol,
  406.                                         NewRow,
  407.                                         CurrentTopMostDataRow,
  408.                                         CurrentLeftMostDataCol,
  409.                                         CurrentRightMostDataCol:Integer;
  410.                                     Var AccumDataEntry       :WorkString;
  411.                                         CharEntry            :Char);
  412.  
  413. { *************************************************************************** }
  414. { *                                                                         * }
  415. { *          CHECK SCROLLING INPUT PAGE CHARACTER INPUT ENTRY MODULE        * }
  416. { *                                                                         * }
  417. { *   This module checks the passed CharEntry character and checks to see   * }
  418. { *   that it is a legal character for the passed input entry location      * }
  419. { *   If CharEntry is legal then this module adds the CharEntry to the      * }
  420. { *   passed AccumDataEntry (accumulated data entry string).  If CharEntry  * }
  421. { *   is not legal then this module ignores the passed character and sounds * }
  422. { *   an error to identify that the user has keystroked in an illegal       * }
  423. { *   character.                                                            * }
  424. { *                                                                         * }
  425. { *   This module begins by first checking to see if the accumulated data   * }
  426. { *   entry length is less than the maximum allowed length.  Finally the    * }
  427. { *   module checks that to see if the single character that has been       * }
  428. { *   entered is of the type allowed.                                       * }
  429. { *                                                                         * }
  430. { *   A list of different input data types this module can check for        * }
  431. { *   follows:                                                              * }
  432. { *                                                                         * }
  433. { *         Input                                                           * }
  434. { *         Data                                                            * }
  435. { *         Type                                                            * }
  436. { *         Value       Description of Input Data Type                      * }
  437. { *         -----       -----------------------------------------           * }
  438. { *           1         Positive Integer ( including zero )                 * }
  439. { *           2         Negative Integer ( including zero )                 * }
  440. { *           3         Integer                                             * }
  441. { *           4         Positive Real ( including zero )                    * }
  442. { *           5         Negative Real ( including zero )                    * }
  443. { *           6         Real                                                * }
  444. { *           7         Data File Name                                      * }
  445. { *           8         Disk Drive Subdirectory Path                        * }
  446. { *           9         General                                             * }
  447. { *                                                                         * }
  448. { *************************************************************************** }
  449.  
  450.  
  451. Type
  452.   CharSet=Set Of Char;                 { a set of legal characters used for checking the character entry }
  453.  
  454. Var
  455.   LegalCharSet:CharSet;                { a variable used for storing the set of legal characters }
  456.  
  457.  
  458.  
  459.   Procedure DetermineLegalCharSet(    DataType    :Integer;
  460.                                       DataEntry   :WorkString;
  461.                                   Var LegalCharSet:CharSet);
  462.  
  463.   { This procedure determines the legal set of characters for the current data
  464.     entry by looking at the passed DataType value. }
  465.  
  466.   Var
  467.     DecimalOccurrence:Boolean;         { boolean used to test for the occurence of a decimal point in the passed string }
  468.  
  469.   Begin   { DetermineLegalCharSet }
  470.     DecimalOccurrence:=(Pos('.',DataEntry)<>0); { If true then decimal point is contained within data entry }
  471.     Case DataType Of
  472.       1 : Begin { Positive Integer }
  473.             LegalCharSet:=['0'..'9'];
  474.           End;  { Positive Integer }
  475.       2 : Begin { Negative Integer }
  476.             If Length(DataEntry)=0 Then
  477.               LegalCharSet:=['-']
  478.             Else
  479.               LegalCharSet:=['0'..'9'];
  480.           End;  { Negative Integer }
  481.       3 : Begin { Integer }
  482.             If Length(DataEntry)=0 Then
  483.               LegalCharSet:=['-','0'..'9']
  484.             Else
  485.               LegalCharSet:=['0'..'9'];
  486.           End;  { Integer }
  487.       4 : Begin { Positive Real }
  488.             If DecimalOccurrence Then
  489.               LegalCharSet:=['0'..'9']
  490.             Else
  491.               LegalCharSet:=['.','0'..'9'];
  492.           End;  { Positive Real }
  493.       5 : Begin { Negative Real }
  494.             If Length(DataEntry)=0 Then
  495.               LegalCharSet:=['-']
  496.             Else
  497.               If DecimalOccurrence Then
  498.                 LegalCharSet:=['0'..'9']
  499.               Else
  500.                 LegalCharSet:=['.','0'..'9'];
  501.           End;  { Negative Real }
  502.       6 : Begin { Real }
  503.             If Length(DataEntry)=0 Then
  504.               LegalCharSet:=['-','.','0'..'9']
  505.             Else
  506.               If DecimalOccurrence Then
  507.                 LegalCharSet:=['0'..'9']
  508.               Else
  509.                 LegalCharSet:=['.','0'..'9'];
  510.           End;  { Real }
  511.       7 : Begin { Data File Name }
  512.             LegalCharSet:=['A'..'Z','a'..'z','0'..'9','_','-','!','@','#','$',
  513.                            '%','&'];
  514.           End;  { Data File Name }
  515.       8 : Begin { Disk Drive Subdirectory Path }
  516.             LegalCharSet:=['A'..'Z','a'..'z','0'..'9','_','-','!','@','#','$',
  517.                            '%','&','\',':'];
  518.           End;  { Disk Drive Subdirectory Path }
  519.       9 : Begin { General }
  520.             LegalCharSet:=['A'..'Z','a'..'z','0'..'9','`','~','!','@','#','$',
  521.                            '%','^','&','*','(',')','-','_','=','+','\','|','[',
  522.                            '{',']','}',';',':','"',',','<','.','>','/','?',' '];
  523.           End;  { General }
  524.     End; { Case DataType }
  525.   End;    { DetermineLegalCharSet }
  526.  
  527.  
  528.  
  529. Begin   { Check_S_I_CharEntryModule }
  530.   If Length(AccumDataEntry)<MAX_SIZE_OF_S_I_ENTRY Then { check length of accumulated data entry }
  531.     Begin                              { accumulated character entry length less than maximum allowable length }
  532.       DetermineLegalCharSet(S_I_Pages[S_I_Page].Prompts[NewCol+1].InputDataType,
  533.                             AccumDataEntry,
  534.                             LegalCharSet);
  535.       If CharEntry In LegalCharSet Then
  536.         Begin { legal character entry, add to accumulated data entry }
  537.           AccumDataEntry:=AccumDataEntry+CharEntry;
  538.           If Length(AccumDataEntry)=1 Then
  539.             Show_S_I_EmptyEntry(NewCol, { procedure call overwrites the old entry }
  540.                                 NewRow,
  541.                                 CurrentTopMostDataRow,
  542.                                 CurrentLeftMostDataCol,
  543.                                 CurrentRightMostDataCol);
  544.           Show_S_I_CharEntry(CharEntry);
  545.         End { If CharEntry }
  546.       Else { illegal character entry }
  547.         SoundError;
  548.     End { If Length(AccumDataEntry) }
  549.   Else { allowable length of accumulated character entry has been reached, no more entry of characters allowed }
  550.     SoundError;
  551. End;    { Check_S_I_CharEntryModule }
  552.  
  553.  
  554.  
  555. Procedure Special_S_I_CharEntryModule(Var OldCol                 :Integer;
  556.                                           OldRow                 :Integer;
  557.                                       Var NewCol                 :Integer;
  558.                                           NewRow,
  559.                                           CurrentTopMostDataRow  :Integer;
  560.                                       Var CurrentLeftMostDataCol,
  561.                                           CurrentRightMostDataCol:Integer;
  562.                                           CharEntry              :Char);
  563.  
  564. { *************************************************************************** }
  565. { *                                                                         * }
  566. { *            SPECIAL SCROLLING INPUT PAGE CHARACTER ENTRY MODULE          * }
  567. { *                                                                         * }
  568. { *    There may be specific input data entries that have been defined to   * }
  569. { *    have 2, 3, or more special characters as input.  This module checks  * }
  570. { *    for the entry of these special characters.                           * }
  571. { *                                                                         * }
  572. { *    Note that the case statement below only supports 4 scrolling input   * }
  573. { *    pages, but this can easily be added to inorder for this module to    * }
  574. { *    support additional scrolling input pages.                            * }
  575. { *                                                                         * }
  576. { *    Note that the procedures within this module have been written        * }
  577. { *    specifically for the example application of the input pre-processor. * }
  578. { *    You may want to write similar procedures for your application.       * }
  579. { *                                                                         * }
  580. { *************************************************************************** }
  581.  
  582.  
  583.  
  584.   Procedure DetermineLoadType(    Entry:Char);
  585.  
  586.   { This procedure is specific to the example application of the input
  587.     pre-processor.  This procedure allows the user to enter a special quick
  588.     character input entry.  You may want to write a similar procedure for
  589.     your application.
  590.  
  591.     This procedure determines the loading type the user has selected for this
  592.     particular loading data entry.  The following load types are available:
  593.  
  594.               Initial
  595.               Construction
  596.               Dead
  597.               Live                               }
  598.  
  599.   Begin   { DetermineLoadType }
  600.     OldCol:=NewCol;
  601.     OldRow:=NewRow;
  602.     If Entry In ['I','i','C','c','D','d','L','l'] Then { determine if a legal character was entered }
  603.       Begin { legal character entry }
  604.         Case Entry Of
  605.           'I','i' : Begin { Initial Loading }
  606.                       S_I_Data[NewCol,NewRow,S_I_Page]^:='INITIAL';
  607.                     End;  { Initial Loading }
  608.           'C','c' : Begin { Construction Loading }
  609.                       S_I_Data[NewCol,NewRow,S_I_Page]^:='CONSTR.';
  610.                     End;  { Construction Loading }
  611.           'D','d' : Begin { Dead Loading }
  612.                       S_I_Data[NewCol,NewRow,S_I_Page]^:='DEAD';
  613.                     End;  { Dead Loading }
  614.           'L','l' : Begin { Live Loading }
  615.                       S_I_Data[NewCol,NewRow,S_I_Page]^:='LIVE';
  616.                     End;  { Live Loading }
  617.         End; { Case Entry }
  618.         NewCol:=NewCol+1;
  619.         If NewCol>CurrentRightMostDataCol Then
  620.           ShiftScrollWindowDataSidewaysModule(NewCol,
  621.                                               CurrentTopMostDataRow,
  622.                                               CurrentLeftMostDataCol,
  623.                                               CurrentRightMostDataCol);
  624.         { following routine handles special case when only one data column is displayed in the scrolling window }
  625.         If CurrentLeftMostDataCol=CurrentRightMostDataCol Then
  626.           OldCol:=NewCol;
  627.         MoveScrollWindowInputBlockModule(OldCol,
  628.                                          OldRow,
  629.                                          NewCol,
  630.                                          NewRow,
  631.                                          CurrentTopMostDataRow,
  632.                                          CurrentLeftMostDataCol,
  633.                                          CurrentRightMostDataCol);
  634.  
  635.         DisplayBeamLoadModule(NewCol,NewRow); { specific to example application of the input pre-processor }
  636.  
  637.       End { If Ord(Entry) }
  638.     Else { illegal character entry }
  639.         SoundError;
  640.   End;    { DetermineLoadType }
  641.  
  642.  
  643.  
  644. Begin   { Special_S_I_CharEntryModule }
  645.   Case S_I_Page Of
  646.     1 : Begin
  647.           DetermineLoadType(CharEntry);
  648.         End; { page 1 }
  649.     2 : Begin
  650.           DetermineLoadType(CharEntry);
  651.         End; { page 2 }
  652.     3 : Begin
  653.           DetermineLoadType(CharEntry);
  654.         End; { page 3 }
  655.     4 : Begin
  656.           DetermineLoadType(CharEntry);
  657.         End; { page 4 }
  658.   End; { Case G_I_Page }
  659. End;    { Special_S_I_CharEntryModule }
  660.  
  661.  
  662.  
  663. Procedure S_I_EntryModule;
  664.  
  665. { *************************************************************************** }
  666. { *                                                                         * }
  667. { *                    SCROLLING INPUT PAGES ENTRY MODULE                   * }
  668. { *                                                                         * }
  669. { *   This module controls the user's input for the scrolling input pages.  * }
  670. { *   This module passes control to specific procedures within if a screen  * }
  671. { *   command is called upon.                                               * }
  672. { *                                                                         * }
  673. { *************************************************************************** }
  674.  
  675.  
  676.  
  677. Var
  678.     OldInputCol:Integer;               { column index to the previously highlighted input block }
  679.     OldInputRow:Integer;               { row index to the previously highlighted input block }
  680.  
  681.     CurrentInputCol:Integer;           { column index to the current highlighted input block }
  682.     CurrentInputRow:Integer;           { row index to the current highlighted input block }
  683.  
  684.     CurrentTopMostDataRow:Integer;     { used to identify the current data row number for the data }
  685.                                        { at the topmost row of the current scrolling input window }
  686.     CurrentLeftMostDataCol:Integer;    { used to identify the current data column number for the data }
  687.                                        { at the leftmost column of the current scrolling input window }
  688.     CurrentRightMostDataCol:Integer;   { used to identify the current data column number for the data }
  689.                                        { at the rightmost column of the current scrolling input window }
  690.  
  691.     ExitModule:Boolean;                { flag used in determining when to exit this input module }
  692.  
  693.  
  694.  
  695.   Procedure Init_S_I_Variables;
  696.  
  697.   { This procedure initializes the S_I_Page module's variables. Note that the
  698.     case statement below only supports 4 scrolling input pages, but can easily
  699.     be added to inorder to support additional pages. }
  700.  
  701.   Begin   { Init_S_I_Variables }
  702.     OldInputCol:=1;
  703.     OldInputRow:=1;
  704.     CurrentInputCol:=1;
  705.     CurrentInputRow:=1;
  706.     CurrentTopMostDataRow:=1;
  707.     Case S_I_Page Of
  708.       1 : Begin
  709.             CurrentLeftMostDataCol:=1;
  710.             CurrentRightMostDataCol:=3; { 3 data columns displayed in scrolling window }
  711.           End; { page 1 }
  712.       2 : Begin
  713.             CurrentLeftMostDataCol:=1;
  714.             CurrentRightMostDataCol:=1; { 1 data column displayed in scrolling window }
  715.           End; { page 2 }
  716.       3 : Begin
  717.             CurrentLeftMostDataCol:=1;
  718.             CurrentRightMostDataCol:=6; { 6 data columns displayed in scrolling window }
  719.           End; { page 3 }
  720.       4 : Begin
  721.             CurrentLeftMostDataCol:=1;
  722.             CurrentRightMostDataCol:=3; { 3 data columns displayed in scrolling window }
  723.           End; { page 4 }
  724.     End; { Case S_I_Page }
  725.     ExitModule:=False;
  726.   End;    { Init_S_I_Variables }
  727.  
  728.  
  729.  
  730.   Procedure Escape;
  731.  
  732.   { This procedure controls the entry of a escape command.  Note that upon
  733.     issuing the escape command the user is signaling that he wants to exit the
  734.     input pre-processor.  Before exiting the pre-processor the user is queried
  735.     if he wants to save the data he has entered.
  736.  
  737.     Note that the case statement below only supports 4 scrolling input pages,
  738.     but can easily be added to inorder to support additional pages. }
  739.  
  740.   Begin   { Escape }
  741.     Case S_I_Page Of
  742.       1 : Begin
  743.             WriteInputFileModule(ExitModule); { if passed boolean returns true, then exit this module }
  744.           End; { page 1 }
  745.       2 : Begin
  746.             WriteInputFileModule(ExitModule); { if passed boolean returns true, then exit this module }
  747.           End; { page 2 }
  748.       3 : Begin
  749.             WriteInputFileModule(ExitModule); { if passed boolean returns true, then exit this module }
  750.           End; { page 3 }
  751.       4 : Begin
  752.             WriteInputFileModule(ExitModule); { if passed boolean returns true, then exit this module }
  753.           End; { page 4 }
  754.     End; { Case S_I_Page }
  755.     If ExitModule Then
  756.       Begin { return to MainModule and then to first menu page }
  757.         MenuPage:=1;
  758.         CurrentPage:=Menu;
  759.       End; { If ExitModule }
  760.   End;    { Escape }
  761.  
  762.  
  763.  
  764.   Procedure PageUp;
  765.  
  766.   { This procedure controls the entry of a page up command.  Note that the case
  767.     statement below only supports 4 scrolling input pages, but can easily be
  768.     added to inorder to support additional pages. }
  769.  
  770.   Begin   { PageUp }
  771.     Case S_I_Page Of
  772.       1 : Begin
  773.             CurrentPage:=G_I;
  774.             G_I_Page:=1;
  775.             ExitModule:=True;
  776.           End; { page 1 }
  777.       2 : Begin
  778.             CurrentPage:=S_I;
  779.             S_I_Page:=1;
  780.             ExitModule:=True;
  781.           End; { page 2 }
  782.       3 : Begin
  783.             CurrentPage:=S_I;
  784.             S_I_Page:=2;
  785.             ExitModule:=True;
  786.           End; { page 3 }
  787.       4 : Begin
  788.             CurrentPage:=S_I;
  789.             S_I_Page:=3;
  790.             ExitModule:=True;
  791.           End; { page 4 }
  792.     End; { Case S_I_Page }
  793.   End;    { PageUp }
  794.  
  795.  
  796.  
  797.   Procedure PageDown;
  798.  
  799.   { This procedure controls the entry of a page down command. Note that the
  800.     case statement below only supports 4 scrolling input pages, but can easily
  801.     be added to inorder for this module to support additional pages. }
  802.  
  803.   Begin   { PageDown }
  804.     Case S_I_Page Of
  805.       1 : Begin
  806.             CurrentPage:=S_I;
  807.             S_I_Page:=2;
  808.             ExitModule:=True;
  809.           End; { page 1 }
  810.       2 : Begin
  811.             CurrentPage:=S_I;
  812.             S_I_Page:=3;
  813.             ExitModule:=True;
  814.           End; { page 2 }
  815.       3 : Begin
  816.             CurrentPage:=S_I;
  817.             S_I_Page:=4;
  818.             ExitModule:=True;
  819.           End; { page 3 }
  820.       4 : Begin
  821.             SoundError;
  822.           End; { page 4 }
  823.     End; { Case S_I_Page }
  824.   End;    { PageDown }
  825.  
  826.  
  827.  
  828.   Procedure CurseUp;
  829.  
  830.   { This procedure controls the cursor's upward movement in the scrolling
  831.     window.  If the input block is at the top of the scrolling window, this
  832.     procedure scrolls the window's data entries down one row by inserting a
  833.     blank line at the top of the scrolling window.  It then writes in the data
  834.     entry for that particular row and moves the input block to the new entry
  835.     location.
  836.  
  837.     Before the above cursor movement is allowed the procedure checks to make
  838.     certain that the input block is not at the top row of data entries the
  839.     window views upon. }
  840.  
  841.   Begin   { CurseUp }
  842.     TextColor(ForegroundColor);
  843.     TextBackground(InputWindowColor);
  844.     If CurrentInputRow=1 Then
  845.       SoundError                       { at top of all the entries the window views upon }
  846.     Else
  847.       Begin                            { legal move }
  848.         If CurrentInputRow=CurrentTopMostDataRow Then
  849.           Begin { at top of scrolling window, need to scroll data in the window downward inorder to curse upward }
  850.             { define a portion of the screen that the data is scrolled in as the active window }
  851.             Window(LEFT_EDGE_OF_INNER_SCROLL_WINDOW,
  852.                    TOP_EDGE_OF_INNER_SCROLL_WINDOW,
  853.                    RightEdgeOfInnerScrollWindow,
  854.                    BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW);
  855.             GotoXY(1,1);
  856.             InsLine; { insert a blank line at top of the scrolling window }
  857.             CurrentTopMostDataRow:=CurrentTopMostDataRow-1; { redefine top row of data to be displayed in
  858.               scrolling window }
  859.             ShowRowOfInputData(CurrentInputRow-1, { display new top row of data }
  860.                                CurrentTopMostDataRow,
  861.                                CurrentLeftMostDataCol,
  862.                                CurrentRightMostDataCol);
  863.           End; { If CurrentInputRow }
  864.         OldInputCol:=CurrentInputCol;
  865.         OldInputRow:=CurrentInputRow;
  866.         CurrentInputRow:=CurrentInputRow-1;  { de-increment current data row }
  867.         MoveScrollWindowInputBlockModule(OldInputCol,
  868.                                          OldInputRow,
  869.                                          CurrentInputCol,
  870.                                          CurrentInputRow,
  871.                                          CurrentTopMostDataRow,
  872.                                          CurrentLeftMostDataCol,
  873.                                          CurrentRightMostDataCol);
  874.  
  875.         DisplayBeamLoadModule(CurrentInputCol,CurrentInputRow); { specific to the example application of the pre-processor }
  876.  
  877.       End; { Else }
  878.   End;    { CurseUp }
  879.  
  880.  
  881.  
  882.   Procedure CurseDown;
  883.  
  884.   { This procedure controls the cursor's downward movement in the scrolling
  885.     window.  If the input block is at the bottom of the scrolling window this
  886.     procedure scrolls the window's data entries up one row by writing the data
  887.     entry for the next row at the bottom of the active window.
  888.  
  889.     Before the above cursor movement is allowed the procedure checks to make
  890.     certain that the input block is not at the bottom row of data entries the
  891.     window views upon. }
  892.  
  893.   Begin   { CurseDown }
  894.     TextColor(ForegroundColor);
  895.     TextBackground(InputWindowColor);
  896.     If CurrentInputRow=S_I_ENTRY_LIMIT Then 
  897.       SoundError                       { at bottom of all entries the window views upon }
  898.     Else
  899.       Begin                            { legal move }
  900.         If CurrentInputRow=CurrentTopMostDataRow+BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW-TOP_EDGE_OF_INNER_SCROLL_WINDOW Then
  901.           Begin { at bottom of scrolling window, need to scroll data in the window upward inorder to curse downward }
  902.             { define a portion of the screen that the data is scrolled in as the active window }
  903.             Window(LEFT_EDGE_OF_INNER_SCROLL_WINDOW,
  904.                    TOP_EDGE_OF_INNER_SCROLL_WINDOW,
  905.                    RightEdgeOfInnerScrollWindow,
  906.                    BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW);
  907.             GotoXY(1,BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW-TOP_EDGE_OF_INNER_SCROLL_WINDOW+1);
  908.             WriteLn;
  909.             CurrentTopMostDataRow:=CurrentTopMostDataRow+1; { redefine top row of data to be displayed in
  910.               scrolling window }
  911.             ShowRowOfInputData(CurrentInputRow+1, { display new bottom row of data }
  912.                                CurrentTopMostDataRow,
  913.                                CurrentLeftMostDataCol,
  914.                                CurrentRightMostDataCol);
  915.  
  916.           End; { If CurrentInputRow }
  917.         OldInputCol:=CurrentInputCol;
  918.         OldInputRow:=CurrentInputRow;
  919.         CurrentInputRow:=CurrentInputRow+1; { increment current data row }
  920.         MoveScrollWindowInputBlockModule(OldInputCol,
  921.                                          OldInputRow,
  922.                                          CurrentInputCol,
  923.                                          CurrentInputRow,
  924.                                          CurrentTopMostDataRow,
  925.                                          CurrentLeftMostDataCol,
  926.                                          CurrentRightMostDataCol);
  927.  
  928.         DisplayBeamLoadModule(CurrentInputCol,CurrentInputRow); { specific to the example application of the pre-processor }
  929.  
  930.       End; { Else }
  931.   End;    { CurseDown }
  932.  
  933.  
  934.  
  935.   Procedure CurseLeft;
  936.  
  937.   { This procedure controls the cursor's leftward movement in the current
  938.     scrolling window. }
  939.  
  940.   Begin   { CurseLeft }
  941.     If CurrentInputCol<>MAX_LEFT_COL Then
  942.       Begin { legal move }
  943.         OldInputCol:=CurrentInputCol;
  944.         OldInputRow:=CurrentInputRow;
  945.         CurrentInputCol:=CurrentInputCol-1;
  946.         If CurrentInputCol<CurrentLeftMostDataCol Then
  947.           ShiftScrollWindowDataSidewaysModule(CurrentInputCol,
  948.                                               CurrentTopMostDataRow,
  949.                                               CurrentLeftMostDataCol,
  950.                                               CurrentRightMostDataCol);
  951.         { following routine handles special case when only one data column is displayed in the scrolling window }
  952.         If CurrentLeftMostDataCol=CurrentRightMostDataCol Then
  953.           OldInputCol:=CurrentInputCol;
  954.         MoveScrollWindowInputBlockModule(OldInputCol,
  955.                                          OldInputRow,
  956.                                          CurrentInputCol,
  957.                                          CurrentInputRow,
  958.                                          CurrentTopMostDataRow,
  959.                                          CurrentLeftMostDataCol,
  960.                                          CurrentRightMostDataCol);
  961.       End { If CurrentInputCol }
  962.     Else { not a legal move }
  963.       SoundError;
  964.   End;    { CurseLeft }
  965.  
  966.  
  967.  
  968.   Procedure CurseRight;
  969.  
  970.   { This procedure controls the cursor's rightward movement in the current
  971.     scrolling window. }
  972.  
  973.   Begin   { CurseRight }
  974.     If CurrentInputCol<>MaxRightCol Then
  975.       Begin { legal move }
  976.         OldInputCol:=CurrentInputCol;
  977.         OldInputRow:=CurrentInputRow;
  978.         CurrentInputCol:=CurrentInputCol+1;
  979.         If CurrentInputCol>CurrentRightMostDataCol Then
  980.           ShiftScrollWindowDataSidewaysModule(CurrentInputCol,
  981.                                               CurrentTopMostDataRow,
  982.                                               CurrentLeftMostDataCol,
  983.                                               CurrentRightMostDataCol);
  984.         { following routine handles special case when only one data column is displayed in the scrolling window }
  985.         If CurrentLeftMostDataCol=CurrentRightMostDataCol Then
  986.           OldInputCol:=CurrentInputCol;
  987.         MoveScrollWindowInputBlockModule(OldInputCol,
  988.                                          OldInputRow,
  989.                                          CurrentInputCol,
  990.                                          CurrentInputRow,
  991.                                          CurrentTopMostDataRow,
  992.                                          CurrentLeftMostDataCol,
  993.                                          CurrentRightMostDataCol);
  994.       End { If CurrentInputCol }
  995.     Else { not a legal move }
  996.       SoundError;
  997.   End;    { CurseRight }
  998.  
  999.  
  1000.  
  1001.   Procedure DeleteEntry;
  1002.  
  1003.   { This procedure controls the deletion of a entry in the current scrolling
  1004.     window. }
  1005.  
  1006.   Begin   { DeleteEntry }
  1007.     S_I_Data[CurrentInputCol,CurrentInputRow,S_I_Page]^:='';
  1008.     OldInputCol:=CurrentInputCol;
  1009.     OldInputRow:=CurrentInputRow;
  1010.     MoveScrollWindowInputBlockModule(OldInputCol,
  1011.                                      OldInputRow,
  1012.                                      CurrentInputCol,
  1013.                                      CurrentInputRow,
  1014.                                      CurrentTopMostDataRow,
  1015.                                      CurrentLeftMostDataCol,
  1016.                                      CurrentRightMostDataCol);
  1017.  
  1018.     DisplayBeamLoadModule(CurrentInputCol,CurrentInputRow); { specific to the example application of the pre-processor }
  1019.  
  1020.   End;    { DeleteEntry }
  1021.  
  1022.  
  1023.  
  1024.   Procedure Backspace(Var AccumCharEntry:Workstring);
  1025.  
  1026.   { This procedure removes the last character in the accumulated character
  1027.     entry in the current scrolling window. }
  1028.  
  1029.   Var
  1030.     CharEntry:Char;                    { char variable used to print out the newly shortened input string }
  1031.     Col:Integer;                       { column index counter used to print out the newly shortened input string }
  1032.  
  1033.   Begin   { Backspace }
  1034.     If Length(AccumCharEntry)<>0 Then
  1035.       Begin
  1036.         Delete(AccumCharEntry,Length(AccumCharEntry),1); { remove last character in the accumulated string entry }
  1037.         Show_S_I_EmptyEntry(CurrentInputCol,             { rewrite over old entry with empty input block }
  1038.                             CurrentInputRow,
  1039.                             CurrentTopMostDataRow,
  1040.                             CurrentLeftMostDataCol,
  1041.                             CurrentRightMostDataCol);
  1042.         For Col:=1 To Length(AccumCharEntry) Do
  1043.           Begin                        { re-display newly shortened accumulated string entry }
  1044.             CharEntry:=Copy(AccumCharEntry,Col,1);
  1045.             Show_S_I_CharEntry(CharEntry);
  1046.           End; { For Col }
  1047.       End { If Length }
  1048.     Else { not able to remove any more characters from empty input data entry }
  1049.       SoundError;
  1050.   End;    { Backspace }
  1051.  
  1052.  
  1053.  
  1054.   Procedure CarriageReturn;
  1055.  
  1056.   { This procedure accepts the user's carriage return entry and in response
  1057.     moves the reversed video input block to the next entry in the scrolling
  1058.     input data window.
  1059.  
  1060.     Note that there are seven special cases that this procedure must be able
  1061.     to handle:
  1062.  
  1063.            1. Move entry block to next entry to the right.
  1064.            2. Shift data columns to left in the scroll window inorder to move
  1065.               entry block to the next entry to the right.
  1066.            3. Entry block at extreme right entry, must move to next line's
  1067.               first entry.
  1068.            4. Entry block at extreme right entry, must move to next line's
  1069.               first entry, but must shift data columns to right to get access
  1070.               to the next line's first entry.
  1071.            5. Entry block at extreme right entry and bottom of the scrolling
  1072.               window.  Need to insert a line at the bottom of the scrolling
  1073.               window to be able to access next line's first entry.
  1074.            6. Entry block at extreme right entry and bottom of the scrolling
  1075.               window.  Need to insert a line at the bottom of the scrolling
  1076.               window and shift data columns to the right inorder to access
  1077.               the next line's first entry.
  1078.            7. At the extreme lower right data entry in the scrolling window
  1079.               and cannot move the entry block any further. }
  1080.  
  1081.   Begin   { CarriageReturn }
  1082.     OldInputCol:=CurrentInputCol;
  1083.     OldInputRow:=CurrentInputRow;
  1084.     { check for Not Case 7 }
  1085.     If Not((CurrentInputCol=MaxRightCol) And (CurrentInputRow=S_I_ENTRY_LIMIT)) Then
  1086.       { check for Not Case 1 or 2 }
  1087.       If CurrentInputCol=MaxRightCol Then
  1088.         Begin { Case 3, 4, 5, & 6 }
  1089.           { increment entry col & row indexes }
  1090.           CurrentInputCol:=MAX_LEFT_COL;
  1091.           CurrentInputRow:=CurrentInputRow+1;
  1092.           { check for Case 5 & 6 }
  1093.           If CurrentInputRow=CurrentTopMostDataRow+BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW-TOP_EDGE_OF_INNER_SCROLL_WINDOW+1 Then
  1094.             Begin { Case 5 & 6 }
  1095.               { routine inserts a blank line at the bottom of the scroll window, moving all displayed data entries up 1 row }
  1096.               TextColor(ForegroundColor);
  1097.               TextBackground(InputWindowColor);
  1098.               Window(LEFT_EDGE_OF_INNER_SCROLL_WINDOW, { define portion of screen data is to be scrolled in }
  1099.                      TOP_EDGE_OF_INNER_SCROLL_WINDOW,
  1100.                      RightEdgeOfInnerScrollWindow,
  1101.                      BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW);
  1102.               GotoXY(1,BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW-TOP_EDGE_OF_INNER_SCROLL_WINDOW+1);
  1103.               WriteLn; { insert a blank line at screen bottom }
  1104.               { redefine top row of data being displayed in the scrolling window }
  1105.               CurrentTopMostDataRow:=CurrentTopMostDataRow+1;
  1106.               ShowRowOfInputData(CurrentInputRow,
  1107.                                  CurrentTopMostDataRow,
  1108.                                  CurrentLeftMostDataCol,
  1109.                                  CurrentRightMostDataCol);
  1110.             End; { Case 5 & 6 }
  1111.           { check for Case 4 & 6 }
  1112.           If CurrentLeftMostDataCol<>MAX_LEFT_COL Then
  1113.             Begin { Case 4 & 6 }
  1114.               { following statement prevents attempted removal of old entry block }
  1115.               OldInputCol:=CurrentInputCol;
  1116.               ShiftScrollWindowDataSidewaysModule(CurrentInputCol,
  1117.                                                   CurrentTopMostDataRow,
  1118.                                                   CurrentLeftMostDataCol,
  1119.                                                   CurrentRightMostDataCol);
  1120.             End; { Case 4 & 6 }
  1121.         End { Case 3, 4, 5, & 6 }
  1122.       Else
  1123.         Begin { Case 1 & 2 }
  1124.           { increment entry col index }
  1125.           CurrentInputCol:=CurrentInputCol+1;
  1126.           If CurrentInputCol>CurrentRightMostDataCol Then
  1127.             Begin { Case 2 }
  1128.               ShiftScrollWindowDataSidewaysModule(CurrentInputCol,
  1129.                                                   CurrentTopMostDataRow,
  1130.                                                   CurrentLeftMostDataCol,
  1131.                                                   CurrentRightMostDataCol);
  1132.               { following routine handles special case when only one data column is displayed in the scrolling window }
  1133.               If CurrentLeftMostDataCol=CurrentRightMostDataCol Then
  1134.                 OldInputCol:=CurrentInputCol;
  1135.             End; { Case 2 }
  1136.         End; { Case 1 & 2 }
  1137.     { Case 1 thru 7 }
  1138.     MoveScrollWindowInputBlockModule(OldInputCol,
  1139.                                      OldInputRow,
  1140.                                      CurrentInputCol,
  1141.                                      CurrentInputRow,
  1142.                                      CurrentTopMostDataRow,
  1143.                                      CurrentLeftMostDataCol,
  1144.                                      CurrentRightMostDataCol);
  1145.  
  1146.     { the following is specific to the example application of the input pre-processor }
  1147.     DisplayBeamLoadModule(CurrentInputCol,CurrentInputRow);
  1148.  
  1149.   End;    { CarriageReturn }
  1150.  
  1151.  
  1152.  
  1153.   Procedure AccumulateEntry(    CharEntry:Char);
  1154.  
  1155.   { This procedure controls the accumulation of inputed characters for a data
  1156.     entry for the current scrolling input page.  Note that the call to
  1157.     Check_S_I_CharEntryModule checks to see if the CharEntry is legal, and if
  1158.     so then places the legal character into the AccumDataEntry. }
  1159.  
  1160.   Var
  1161.     AccumDataEntry:WorkString;         { string variable used for accumulating the data entry }
  1162.  
  1163.   Begin   { AccumulateEntry }
  1164.     AccumDataEntry:='';                { initialize accumulated keyboard entry }
  1165.     ShowBlinkingCursor;
  1166.     Window(LEFT_EDGE_OF_INNER_SCROLL_WINDOW,
  1167.            TOP_EDGE_OF_INNER_SCROLL_WINDOW,
  1168.            RightEdgeOfInnerScrollWindow,
  1169.            BOTTOM_EDGE_OF_INNER_SCROLL_WINDOW);
  1170.     { locate at start of data entry }
  1171.     GotoXY(((CurrentInputCol-CurrentLeftMostDataCol+1)*COL_WIDTH)+1,CurrentInputRow-CurrentTopMostDataRow+1);
  1172.     Check_S_I_CharEntryModule(CurrentInputCol,
  1173.                               CurrentInputRow,
  1174.                               CurrentTopMostDataRow,
  1175.                               CurrentLeftMostDataCol,
  1176.                               CurrentRightMostDataCol,
  1177.                               AccumDataEntry,
  1178.                               CharEntry);
  1179.     Repeat
  1180.       Read(Kbd,CharEntry);
  1181.       If (CharEntry=Chr(27)) And KeyPressed Then  { read illegal double character entry without executing code command }
  1182.         Begin
  1183.           Read(Kbd,CharEntry);
  1184.           SoundError;
  1185.         End { If CharEntry }
  1186.       Else
  1187.         If CharEntry=Chr(8) Then       { backspace }
  1188.           Backspace(AccumDataEntry)
  1189.         Else
  1190.           If CharEntry<>Chr(13) Then   { carriage return }
  1191.             Check_S_I_CharEntryModule(CurrentInputCol,
  1192.                                       CurrentInputRow,
  1193.                                       CurrentTopMostDataRow,
  1194.                                       CurrentLeftMostDataCol,
  1195.                                       CurrentRightMostDataCol,
  1196.                                       AccumDataEntry,
  1197.                                       CharEntry);
  1198.     Until CharEntry=Chr(13);           { carriage Return }
  1199.     HideBlinkingCursor;
  1200.     If (AccumDataEntry='.') Or (AccumDataEntry='-') Or (AccumDataEntry='-.') Then
  1201.       AccumDataEntry:=''; { remove meaningless entry }
  1202.     S_I_ErrorCheckingModule(OldInputCol,
  1203.                             OldInputRow,
  1204.                             CurrentInputCol,
  1205.                             CurrentInputRow,
  1206.                             CurrentTopMostDataRow,
  1207.                             CurrentLeftMostDataCol,
  1208.                             CurrentRightMostDataCol,
  1209.                             AccumDataEntry);
  1210.     S_I_Data[CurrentInputCol,CurrentInputRow,S_I_Page]^:=AccumDataEntry; { transfer data entry into data structure }
  1211.     CarriageReturn;
  1212.   End;    { AccumulateEntry }
  1213.  
  1214.  
  1215.  
  1216.   Procedure ReadKeyboard;
  1217.  
  1218.   { This procedure determines what the user's keyboard entry is.  It passes
  1219.     control to specific procedures within this module if a screen command
  1220.     dealing with any of the scrolling input pages is called upon. }
  1221.  
  1222.   Var
  1223.     KeyboardEntry:Char;                { variable used in storing the character read from the keyboard }
  1224.  
  1225.   Begin   { ReadKeyboard }
  1226.     Read(Kbd,KeyboardEntry);
  1227.     If  (KeyboardEntry=Chr(27)) And KeyPressed Then { read a character, check for a double character entry }
  1228.       Begin                            { double character entry }
  1229.         Read(Kbd,KeyboardEntry);
  1230.         Case Ord(KeyboardEntry) Of
  1231.           73 : PageUp;
  1232.           81 : PageDown;
  1233.           72 : CurseUp;
  1234.           80 : CurseDown;
  1235.           75 : CurseLeft;
  1236.           77 : CurseRight;
  1237.           83 : DeleteEntry;
  1238.         Else { illegal entry }
  1239.           SoundError;
  1240.         End; { Case Ord(KeyboardEntry) }
  1241.       End { If KeyboardEntry }
  1242.     Else
  1243.       Begin                            { single character entry }
  1244.         Case Ord(KeyboardEntry) Of
  1245.           13 : CarriageReturn;
  1246.           27 : Escape;
  1247.         Else
  1248.           If CurrentInputCol=1 Then { check for a special character entry }
  1249.             Special_S_I_CharEntryModule(OldInputCol,
  1250.                                         OldInputRow,
  1251.                                         CurrentInputCol,
  1252.                                         CurrentInputRow,
  1253.                                         CurrentTopMostDataRow,
  1254.                                         CurrentLeftMostDataCol,
  1255.                                         CurrentRightMostDataCol,
  1256.                                         KeyboardEntry)
  1257.           Else { accumulate input entry from user }
  1258.             AccumulateEntry(KeyboardEntry);
  1259.         End; { Case Ord(KeyboardEntry) }
  1260.       End; { Else }
  1261.   End;    { ReadKeyboard }
  1262.  
  1263.  
  1264.  
  1265. Begin   { S_I_EntryModule }
  1266.   Init_S_I_Variables;
  1267.   Draw_S_I_PagesModule(CurrentTopMostDataRow,
  1268.                        CurrentLeftMostDataCol,
  1269.                        CurrentRightMostDataCol);
  1270.   Repeat
  1271.     ReadKeyboard;
  1272.   Until ExitModule;
  1273. End;    { S_I_EntryModule }
  1274.